package com.opener.web.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * Created by baboy on 02/12/2016.
 */
public class HttpRequestCacheFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (request instanceof HttpServletRequest){
            HttpRequestCacheServlet cacheServlet = new HttpRequestCacheServlet((HttpServletRequest)request);
            chain.doFilter(cacheServlet,response);

        }else{
            chain.doFilter(request,response);
        }

    }

    @Override
    public void destroy() {
    }
}
